package com.ruowei.modules.foodOrder.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;

import java.io.Serializable;
import java.time.Instant;

/**
 * 商品分类表
 */
@ApiModel(description = "商品分类表")
@Entity
@Table(name = "merchandise_type")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class MerchandiseType implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 分类编码
     */
    @ApiModelProperty(value = "分类编码")
    @Column(name = "type_code")
    private String typeCode;

    /**
     * 分类名称
     */
    @ApiModelProperty(value = "分类名称")
    @Column(name = "type_name")
    private String typeName;

    /**
     * 商家编码
     */
    @ApiModelProperty(value = "商家编码")
    @Column(name = "merchant_code")
    private String merchantCode;

    /**
     * 状态
     */
    @ApiModelProperty(value = "状态")
    @Column(name = "status")
    private Boolean status;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @Column(name = "create_time")
    private Instant createTime;

    /**
     * 上级分类编码
     */
    @ApiModelProperty(value = "上级分类编码")
    @Column(name = "parent_code")
    private String parentCode;

    /**
     * 层级
     */
    @ApiModelProperty(value = "层级")
    @Column(name = "jhi_level")
    private Integer level;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @Column(name = "jhi_sort")
    private Integer sort;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Lob
    @Column(name = "remark")
    private String remark;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMerchantCode() {
        return merchantCode;
    }

    public void setMerchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
    }

    public String getTypeCode() {
        return typeCode;
    }

    public MerchandiseType typeCode(String typeCode) {
        this.typeCode = typeCode;
        return this;
    }

    public void setTypeCode(String typeCode) {
        this.typeCode = typeCode;
    }

    public String getTypeName() {
        return typeName;
    }

    public MerchandiseType typeName(String typeName) {
        this.typeName = typeName;
        return this;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public Boolean isStatus() {
        return status;
    }

    public MerchandiseType status(Boolean status) {
        this.status = status;
        return this;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public Instant getCreateTime() {
        return createTime;
    }

    public MerchandiseType createTime(Instant createTime) {
        this.createTime = createTime;
        return this;
    }

    public void setCreateTime(Instant createTime) {
        this.createTime = createTime;
    }

    public String getParentCode() {
        return parentCode;
    }

    public MerchandiseType parentCode(String parentCode) {
        this.parentCode = parentCode;
        return this;
    }

    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }

    public Integer getLevel() {
        return level;
    }

    public MerchandiseType level(Integer level) {
        this.level = level;
        return this;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Integer getSort() {
        return sort;
    }

    public MerchandiseType sort(Integer sort) {
        this.sort = sort;
        return this;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getRemark() {
        return remark;
    }

    public MerchandiseType remark(String remark) {
        this.remark = remark;
        return this;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof MerchandiseType)) {
            return false;
        }
        return id != null && id.equals(((MerchandiseType) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "MerchandiseType{" +
            "id=" + getId() +
            ", typeCode='" + getTypeCode() + "'" +
            ", typeName='" + getTypeName() + "'" +
            ", status='" + isStatus() + "'" +
            ", createTime='" + getCreateTime() + "'" +
            ", parentCode='" + getParentCode() + "'" +
            ", level=" + getLevel() +
            ", sort=" + getSort() +
            ", remark='" + getRemark() + "'" +
            "}";
    }
}
